package VO;

import java.util.ArrayList;

import Promotion.Exchangecoupons;
import Promotion.ExchangecouponsList;

public class ExchangecouponsListVO {
	ArrayList<ExchangecouponsVO>  Exchangecouponslist=new ArrayList<ExchangecouponsVO>();
	String exID="";

	
	public ExchangecouponsListVO (){}
	public ExchangecouponsListVO (ArrayList <ExchangecouponsVO> exlist){
		Exchangecouponslist= exlist;
		init();
	}
	public ExchangecouponsListVO(ExchangecouponsList exlist){
		for(Exchangecoupons ex:exlist.GetExchangecouponsList()){
			ExchangecouponsVO exvo=new ExchangecouponsVO(ex);
			Exchangecouponslist.add(exvo);			
		}
		init();
	}
	public ExchangecouponsListVO(String exlistinfo[][]){
		for(String exinfo[]:exlistinfo){
			ExchangecouponsVO ex=new ExchangecouponsVO(exinfo);
			Exchangecouponslist.add(ex);
		}
	}

	public ExchangecouponsListVO(ExchangecouponsListVO exlOfAll,String exidList){
		String[] exidlist=exidList.split("/");
		if(exidList.equals("")){
			for(String id:exidlist){
				ExchangecouponsVO exvo=exlOfAll.find(Long.parseLong(id));
				Exchangecouponslist.add(exvo);
			}
			init();
		}		
	}
	
	public void init(){
		for(ExchangecouponsVO ex:Exchangecouponslist){
			exID=exID+"/"+ex.getid();
		}
	}

	public ExchangecouponsVO find(long id){
		ExchangecouponsVO ex=null;
		for(ExchangecouponsVO e:Exchangecouponslist){
			if(e.getid()==id){
				ex=e;
				break;
			}
		}
		return ex;
	}
	public ArrayList<ExchangecouponsVO> GetExchangecouponslist(){
		return Exchangecouponslist;
	}
	public String getexlid(){
		return exID;
	}

}
